package com.youkeda.yunmusic.web.control;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

@Controller
public class MusicControl {

    private static final Map<String, String> musics = new HashMap<>();

    @RequestMapping(value = "/song/music")
    @ResponseBody
    //返回一个json数据
    public String getMusicSrc(String songId) {
        return musics.get(songId);
    }

    @PostConstruct
    //让该类在应用初始化时自动执行
    public void inti() {
        musics.put("35847388",
                " http://music.163.com/song/media/outer/url?id=35847388.mp3 ");
        musics.put("574566207",
                "http://music.163.com/song/media/outer/url?id=574566207.mp3");
    }


}

//  http://music.163.com/song/media/outer/url?id=35847388.mp3
//    http://music.163.com/song/media/outer/url?id=16435049.mp3
